From 1281f173cd5f109799ef5974ed6f57165c9d2791 Mon Sep 17 00:00:00 2001 From: secondl1ght <85003930+secondl1ght@users.noreply.github.com> Date: Tue, 2 Aug 2022 20:23:00 -0600 Subject: add settings screen --- src/routes/[username]/settings.svelte | 165 +++++++++++++++++++++++++++++++++- 1 file changed, 163 insertions(+), 2 deletions(-) (limited to 'src/routes/[username]/settings.svelte') diff --git a/src/routes/[username]/settings.svelte b/src/routes/[username]/settings.svelte index 1935b156..ae8e91c1 100644 --- a/src/routes/[username]/settings.svelte +++ b/src/routes/[username]/settings.svelte @@ -1,5 +1,166 @@ - +{#if $user} + + +
+

Settings

+ +
+ + + + + +
+ + {#if setting === 'account'} +
+ + +
+ +
+ + {#if revealPassword} + + {:else} + + {/if} + +
+ +
+
+ Email Notifications + +
+

+ Get notified via email when a change occurs on your account or when people send you + payments. +

+
+ +
+
+ SMS Notifications + +
+

+ CoinOS will send you text notifications when this is enabled. +

+
+ +
+ Color Theme +

Select from the default color themes.

+ {#each colorThemes as colors} +
+ {:else if setting === 'pos'} +
+ + +
+ +
+ + +
+ {:else} +
+ Security Pin +

+ Set a security pin that will be used to unlock your settings and to send outgoing + payments. +

+ +
+ +
+ +

+ Your account will go into a secure mode automatically after a specified time: +

+ +
+ +
+ 2-Factor Authentication +

+ Add an extra level of security to your device by enableing 2-factor authentication. +

+ +
+ {/if} +
+{/if} + + -- cgit v1.2.3 From b2310e9b98bbaa5918003208157e0594307a033f Mon Sep 17 00:00:00 2001 From: secondl1ght <85003930+secondl1ght@users.noreply.github.com> Date: Wed, 3 Aug 2022 22:57:04 -0600 Subject: add tx type to history, add address to settings and other ui updates --- src/routes/[username]/dashboard.svelte | 8 +++----- src/routes/[username]/settings.svelte | 9 +++++++++ src/routes/[username]/transactions.svelte | 19 ++++++++++++------- 3 files changed, 24 insertions(+), 12 deletions(-) (limited to 'src/routes/[username]/settings.svelte') diff --git a/src/routes/[username]/dashboard.svelte b/src/routes/[username]/dashboard.svelte index 6f38a812..11295728 100644 --- a/src/routes/[username]/dashboard.svelte +++ b/src/routes/[username]/dashboard.svelte @@ -56,14 +56,12 @@ > {accountBalanceBtc} BTC ({accountBalanceSats} SATS) + >{accountBalanceSats} SATS -

- You will be charged a 1% withdrawal fee ({$rate ? feeAmount : 'fetching rate...'}) on your balance. +

+ You will be charged a 1% withdrawal fee on the amount.

diff --git a/src/routes/[username]/settings.svelte b/src/routes/[username]/settings.svelte index ae8e91c1..82ed7305 100644 --- a/src/routes/[username]/settings.svelte +++ b/src/routes/[username]/settings.svelte @@ -71,6 +71,15 @@ +
+ + +
+
Email Notifications diff --git a/src/routes/[username]/transactions.svelte b/src/routes/[username]/transactions.svelte index 0e635298..24e3e146 100644 --- a/src/routes/[username]/transactions.svelte +++ b/src/routes/[username]/transactions.svelte @@ -16,30 +16,35 @@
-
+

AMOUNT

-

TIME

+

TYPE

+

TIME

{#if transactions.length} {#each transactions as tx} -
+
{new Intl.NumberFormat('en-US', { + >{tx.amount > 0 && '+'}{new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(tx.amount * (tx.rate / 100000000))} ({new Intl.NumberFormat('en-US', { maximumFractionDigits: 0 }).format(tx.amount)} - SATS) + >{new Intl.NumberFormat('en-US', { maximumFractionDigits: 0 }).format(tx.amount)} + SATS
-
+
+ {tx.amount < 0 ? 'Sent' : 'Received'} +
+ +
{new Date(tx.createdAt).toLocaleDateString(undefined, { dateStyle: 'medium' })}
-- cgit v1.2.3 From 93f9d0abf58c5b5154e35b63524405554042bef1 Mon Sep 17 00:00:00 2001 From: secondl1ght <85003930+secondl1ght@users.noreply.github.com> Date: Sat, 6 Aug 2022 00:04:55 -0600 Subject: finish withdraw UI, add more validation on support, bug fixes on tx hist --- src/lib/utils.js | 6 +- src/routes/[username]/dashboard.svelte | 98 +++++++++++++++++++------------ src/routes/[username]/settings.svelte | 6 +- src/routes/[username]/support.svelte | 19 +++++- src/routes/[username]/transactions.svelte | 12 ++-- src/routes/withdraw.js | 3 +- 6 files changed, 88 insertions(+), 56 deletions(-) (limited to 'src/routes/[username]/settings.svelte') diff --git a/src/lib/utils.js b/src/lib/utils.js index 24f94d40..b42fe970 100644 --- a/src/lib/utils.js +++ b/src/lib/utils.js @@ -19,11 +19,11 @@ export const get = (url, headers = { accept: 'application/json' }) => }); export const post = (url, body, headers) => { - headers = { ...headers, accept: 'application/json', 'content-type': 'application/json' }; + headers = { ...headers, accept: 'application/json', 'content-type': 'application/json' }; return fetch(base + url, { method: 'POST', body: JSON.stringify(body), - headers + headers }) .then((r) => r.text()) .then((body) => { @@ -38,7 +38,7 @@ export const post = (url, body, headers) => { return body; }); -} +}; export const copy = (text) => { navigator.clipboard.writeText(text); diff --git a/src/routes/[username]/dashboard.svelte b/src/routes/[username]/dashboard.svelte index 7fab2125..d056399f 100644 --- a/src/routes/[username]/dashboard.svelte +++ b/src/routes/[username]/dashboard.svelte @@ -1,7 +1,7 @@ {#if $user} @@ -13,7 +15,13 @@
- +
@@ -35,11 +43,18 @@ class="block border rounded-xl p-2 w-full" type="text" name="message" + bind:value={message} required />
- +
{/if} diff --git a/src/routes/[username]/transactions.svelte b/src/routes/[username]/transactions.svelte index 24e3e146..c91fd900 100644 --- a/src/routes/[username]/transactions.svelte +++ b/src/routes/[username]/transactions.svelte @@ -18,8 +18,8 @@

AMOUNT

-

TYPE

-

TIME

+

TYPE

+

TIME

@@ -28,19 +28,21 @@
{tx.amount > 0 && '+'}{new Intl.NumberFormat('en-US', { + >{tx.amount > 0 ? '+' : ''}{new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(tx.amount * (tx.rate / 100000000))} {new Intl.NumberFormat('en-US', { maximumFractionDigits: 0 }).format(tx.amount)} + >{tx.amount > 0 ? '+' : ''}{new Intl.NumberFormat('en-US', { + maximumFractionDigits: 0 + }).format(tx.amount)} SATS
-
+
{tx.amount < 0 ? 'Sent' : 'Received'}
diff --git a/src/routes/withdraw.js b/src/routes/withdraw.js index aaed2250..818d39da 100644 --- a/src/routes/withdraw.js +++ b/src/routes/withdraw.js @@ -1,8 +1,7 @@ import { post } from '$lib/utils'; export async function POST({ locals, request }) { let { token } = locals; - let body = await request.json(); - console.log(body) + let body = await request.json(); body = await post('/lightning/send', body, { authorization: `Bearer ${token}` }); -- cgit v1.2.3